<?php
require 'conecta.php';


echo '<meta charset="utf-8">';
echo '<title>CRUD - READ</title>';

$leitura = "SELECT * FROM cursophp_usuarios WHERE id LIMIT 3";
$query = mysql_query($leitura) or die(mysql_error());


	if (mysql_num_rows($query) <= 0 ){
		echo "Desculpe, a tabela está vazia!";
	}else{
		while ($mostra = mysql_fetch_assoc($query)) {

			echo "<pre>";
				print_r($mostra);
			echo "</pre>";
		}
	}

	echo "<hr />";
	echo "<hr />";

	$leituraId = mysql_real_escape_string($_GET['id']);
	$leituraDois = "SELECT * FROM cursophp_usuarios WHERE id";
	$queryDois = mysql_query($leituraDois) or die(mysql_error());
	$listar = mysql_fetch_assoc($queryDois);

	echo '<div style="border:1px solid #CCC; margin:10x 0 15px 0; passing:15px;">';
			echo '<ul>';
				echo '<li>';
					echo '<h1>'.$listar['titulo'].'</h1>';
					echo '<h3>'.$listar['tags'].'</h3>';
					echo '<p>'.$listar['descricao'].'</p>';
				echo '</li>';
			echo '</ul>';
	echo '</div>';
?>